﻿<Window x:Class="CNGIDemo.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:visualizationToolkit="clr-namespace:System.Windows.Controls.DataVisualization;assembly=System.Windows.Controls.DataVisualization.Toolkit"
        xmlns:chartingToolkit="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"
        xmlns:chartingPrimitivesToolkit="clr-namespace:System.Windows.Controls.DataVisualization.Charting.Primitives;assembly=System.Windows.Controls.DataVisualization.Toolkit"
        Title="CNGIDemo" Height="600" Width="800">
    <Window.Resources>
        <ControlTemplate TargetType="chartingToolkit:Chart" x:Key="ZoomChartTemplate">
            <Border 
                Background="{TemplateBinding Background}"
                BorderBrush="{TemplateBinding BorderBrush}"
                BorderThickness="{TemplateBinding BorderThickness}"
                Padding="5">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>

                    <visualizationToolkit:Title
                        Content="{TemplateBinding Title}"
                        Style="{TemplateBinding TitleStyle}"/>

                    <Grid Grid.Row="1">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>

                        <visualizationToolkit:Legend
                            x:Name="Legend"
                            Header="{TemplateBinding LegendTitle}"
                            Style="{TemplateBinding LegendStyle}"
                            Grid.Column="1"/>

                        <ScrollViewer 
                            x:Name="ScrollArea" BorderThickness="0" 
                            HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Hidden">
                            <chartingPrimitivesToolkit:EdgePanel x:Name="ChartArea" Style="{TemplateBinding ChartAreaStyle}">
                                <Grid Canvas.ZIndex="-1" Style="{TemplateBinding PlotAreaStyle}" />
                                <Border Canvas.ZIndex="1" BorderBrush="#FF919191" BorderThickness="1" />
                            </chartingPrimitivesToolkit:EdgePanel>
                        </ScrollViewer>
                    </Grid>
                </Grid>
            </Border>
        </ControlTemplate>

    </Window.Resources>
    <Viewbox>
        <StackPanel Background="White">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="100"/>
                    <ColumnDefinition Width="auto"/>
                </Grid.ColumnDefinitions>
                <Border BorderThickness="0" BorderBrush="Black" Width="1280" VerticalAlignment="Top" HorizontalAlignment="Left" Grid.Column="0">
                    <StackPanel Orientation="Vertical" >
                        <Button Margin="0,40, 0, 0" x:Name="Interfaces" Content="Choose Interface" Width="100" HorizontalAlignment="Left" Height="40" Click="FindInterfaces"/>
                        <Button Margin="0,80,0,0" x:Name="SetFilter" Content="Set Filter" Width="100" HorizontalAlignment="Left" Height="40" Click="SetFilter_Click"/>
                        <Button Margin="0,120,0,0" x:Name="Start" Content="Start Listening" Width="100" HorizontalAlignment="Left" Height="40" Click="Start_Click"/>
                        <Button Margin="0,160,0,0" x:Name="Stop" Content="Stop Listening" Width="100" HorizontalAlignment="Left" Height="40" Click="Stop_Click"/>
                    </StackPanel>
                </Border>
                <chartingToolkit:Chart Grid.Column="1" HorizontalAlignment="Left" Width="1280" Height="800" Template="{StaticResource ZoomChartTemplate}" x:Name="ZoomChart" Title="CNGIDemo">
                    <chartingToolkit:Chart.Series>
                        <chartingToolkit:LineSeries DependentValuePath="Value" IndependentValuePath="Time" Title="LineSeries For Ipv4" x:Name="LineSeries1">
                            <chartingToolkit:LineSeries.DependentRangeAxis>
                                <chartingToolkit:LinearAxis Orientation="Y" Minimum="-2" Maximum="20" />
                            </chartingToolkit:LineSeries.DependentRangeAxis>
                        </chartingToolkit:LineSeries>
                        <chartingToolkit:LineSeries DependentValuePath="Value" IndependentValuePath="Time" x:Name="LineSeries2" Title="LineSeries For Ipv6">
                            <chartingToolkit:LineSeries.DependentRangeAxis>
                                <chartingToolkit:LinearAxis Orientation="Y" Minimum="-2" Maximum="20" />
                            </chartingToolkit:LineSeries.DependentRangeAxis>
                        </chartingToolkit:LineSeries>
                    </chartingToolkit:Chart.Series>
                </chartingToolkit:Chart>
            </Grid>
            <StackPanel Margin="5,10,0,0" Orientation="Horizontal" >
                <TextBlock Text="Zoom:" />
                <Slider Margin="5,0,0,0" Width="1280" Minimum="0" Maximum="500" ValueChanged="ZoomChanged" />
            </StackPanel>
            
        </StackPanel>
    </Viewbox>
</Window>
